﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using LuaInterface;
namespace Urd.Common
{
    public class LuaSerializable:System.Attribute
    {
        string sectionname;
        public LuaSerializable(string Name) { sectionname = Name; }

    }
    public sealed class LuaSerializator:IDisposable
    {
        LuaInterface.Lua lua;
        string filepath;
        //string output;
        public LuaSerializator(string Filepath) 
        {
            lua = new LuaInterface.Lua();
            filepath = Filepath;
        }
        public string DoSerialize(object Anything) 
        {
            Type type = Anything.GetType();
            string ret = "";
            ret += "{\n";
            ret += "type=\"" + type.ToString() + "\",";
            
            

            MemberInfo[] meminfo = type.GetMembers();
            foreach (MemberInfo info in meminfo) 
            {
                if (info.GetCustomAttribute(typeof(LuaSerializable)) != null) 
                {

                }
            }
            return ret;
        }
        public void Dispose() 
        {
            lua.Dispose();
        }
    }
[LuaSerializable("LuaSerializableSample")]
    public class LuaSerializatorSample
    {
        public LuaSerializatorSample() { }
    }
}
